const state = {
    chooseGg: {},
    num: 1,
    detailId: '',
    goods: {},
    skuId: ''
}
const getters = {}
const mutations = {
    SET_GOODS: (state, item) => {
        console.log('所选商品', item)
        state.goods = item
    },
    SET_CHOOSE_GG: (state, item) => {
        console.log('-----store choosegg----', item)
        state.chooseGg = item
    },
    SET_NUM: (state, item) => {
        state.num = item
    },
    SET_NUM_ADD: (state, item) => {
        state.num += 1
    },
    SET_NUM_REDUCE: (state, item) => {
        state.num -= 1
    },
    SET_DETAIL_ID: (state, id) => {
        console.log('---', id)
        state.detailId = id
    },
    SET_SKUID: (state, id) => {
        state.skuId = id
    }
}
const actions = {
    setGoods({commit}, item) {
        commit('SET_GOODS', item)
    },
    setChooseGG({commit}, item) {
        commit('SET_CHOOSE_GG', item)
    },
    setNum({commit}, item) {
        commit('SET_NUM', item)
    },
    setDetailId({commit}, id) {
        commit('SET_DETAIL_ID', id)
    },
    setSkuId({commit}, id) {
        commit('SET_SKUID', id)
    }

}
export default {
    namespaced: true,
    state,
    actions,
    getters,
    mutations
}
